<template>
	<view class="btn-box" :style="{color:color}" @click="onClick">
		<slot></slot>
	</view>
</template>

<script>
	export default {
		props: {
			color: {
				type: String,
				default: '#000'
			}
		},
		data() {
			return {

			};
		},
		methods: {
			onClick() {
				console.log('我被点击了');
				this.$emit('change', this.color);
				//从组件把事件发射到页面
			}
		}
	}
</script>

<style>
	.btn-box {
		width: 200px;
		height: 100px;
		text-align: center;
		line-height: 100px;
		border: 1px red solid;
	}
</style>
